#include <stdio.h>
#include <string.h>

#define WEEKDAYS  7
#define MAX_STR_LEN 10

int main()
{
    int i, pos = -1;
    int findFlag = 0;
    char x[MAX_STR_LEN];
    char weekDay[][MAX_STR_LEN] = {"Sunday", "Monday", "Tuesday",
                                    "Wednesday", "Thursday", "Friday", "Saturday"
                                   };
    printf("Please enter a string:\n");
    scanf("%s", x);
    for (i = 0; i < WEEKDAYS; i++)
    {
        if (strcmp(x, weekDay[i]) == 0)
        {
            pos = i;
            findFlag = 1;
            break; // 找到后跳出循环
        }
    }
    if (findFlag)
    {
        printf("%s is %d\n", x, pos);
    }
    else
    {
        printf("Not found!\n");
    }
    return 0;
}
